home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
msqc25t1
/
video.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-30
|
3KB
|
98 lines
/* video.c: Displays information about video configuration */
/* Common IBM PC devices only */
#include <stdio.h>
#include <graph.h>
#include "mk_fp.h"
#include "biosarea.h"
#if !defined TRUE
#define FALSE 0
#define TRUE !FALSE
#endif
main ()
{
BIOSDATA far *bios = MK_FP (0x40, 0);
struct videoconfig text, grafix;
short best;
/* Get text and general video information */
_getvideoconfig (&text);
/* Get info about best graphics mode available */
if (text.adapter != _MDPA) {
switch (text.adapter & 0x2f) {
case _CGA : best = _MRES4COLOR; break;
case _EGA : best = _ERESCOLOR; break;
case _VGA : best = _VRES16COLOR; break;
case _MCGA : best = _MRES256COLOR; break;
case _HGC : best = _HERCMONO; break;
}
_setvideomode (best); /* go to best graphics mode */
_getvideoconfig (&grafix); /* get info */
_setvideomode (_DEFAULTMODE); /* return to text mode */
}
/* Report video information */
puts ("Video configuration information:\n");
printf (" General: Adapter type %02X",text.adapter);
switch (text.adapter & 0x2f) {
case _MDPA : puts ("(MDPA"); break;
case _CGA : puts ("(CGA)"); break;
case _EGA : puts ("(EGA)"); break;
case _VGA : puts ("(VGA)"); break;
case _MCGA : puts ("(MCGA)"); break;
case _HGC : puts ("(HGC)"); break;
default : puts ("(Other)"); break;
}
printf (" Monitor type %02X",text.monitor);
switch (text.monitor) {
case 0x0001: puts ("(MONO)"); break;
case 0x0002: puts ("(COLOR)"); break;
case 0x0004: puts ("(ENHCOLOR)"); break;
case 0x0008: puts ("(ANALOGMONO)"); break;
case 0x0010: puts ("(ANALOGCOLOR)"); break;
case 0x0018: puts ("(ANALOG)"); break;
default : puts ("(Other)"); break;
}
printf (" Video memory size %3d Kbytes\n",text.memory);
printf (" Video hardware port %04Xh\n\n",
bios->activeDispPort);
printf (" Text: Rows %3d\n",
text.numtextrows);
printf (" Columns %3d\n",
text.numtextcols);
printf (" Video pages %3d\n",
text.numvideopages);
printf (" Normal video mode %3d\n",
text.mode);
printf (" Video buffer size %4d bytes\n",
bios->vidBuffSz);
printf (" Video memory segment %4Xh\n\n",
text.monitor == _MONO ? 0xB000 : 0xB800);
if (text.adapter != _MDPA) {
printf (" Graphics: Width in pixels %3d\n",
grafix.numxpixels);
printf (" Height in pixels %3d\n",
grafix.numypixels);
printf (" Bits per pixel %3d\n",
grafix.bitsperpixel);
printf (" Number of colors %3d\n",
grafix.numcolors);
printf (" Video pages %3d\n",
grafix.numvideopages);
printf (" Video buffer segment ");
switch (text.adapter){
case _HGC : printf ("%Xh\n", 0xB000); break;
case _CGA : printf ("%Xh\n", 0xB800); break;
default : printf ("%Xh\n", 0xA000); break;
};
}
}